#pragma once
#include "abstractmodel.h"
#include "Point3d.h"
#include "StdAfx.h"

// Normal is represented by an origin and an algebraic vector, defined by an end
// point relative to the origin, as if the origin were equal to (0,0,0).
// This allows the normal to draw itself from any point in space.

class Normal : public Point3d
{
	public:
 		Normal( void )
            : Point3d( 0, 0, 0 )    // the vector itself (end point relative to (0,0,0))
            , origin( 0, 0, 0 )     // vector start point
        { }

        Normal( float nX, float nY, float nZ )
            : Point3d( nX, nY, nZ )
            , origin( 0, 0, 0 )
        { }

        Normal( const Point3d& normal )
            : Point3d( normal )
            , origin( 0, 0, 0 )
        { }

        Normal( float nX, float nY, float nZ, float x, float y, float z )
            : Point3d( nX, nY, nZ )
            , origin( x, y, z )
        { }

        Normal( const Point3d& normal, float x, float y, float z )
            : Point3d( normal )
            , origin( x, y, z )
        { }

        Normal( float nX, float nY, float nZ , const Point3d& origin )
            : Point3d( nX, nY, nZ )
            , origin( origin )
        { }

        Normal( const Point3d& normal, const Point3d& startP )
            : Point3d( normal )
            , origin( startP )
        { }

		virtual void draw( ) const
        {
            // endPoint = origin + normal;
            Point3d endPoint( *this );
            endPoint = endPoint + origin;

//            glBegin( GL_LINES );        // draw a line
            origin.draw( );             // from start point
            endPoint.draw( );           // to end point
//            glEnd( );
		}

		virtual const Point3d& getOrigin( ) const
        {
			return origin;
		}

		virtual void setOrigin( Point3d& point )
        {
			origin = point;
		}

	private:
		Point3d origin;
};